package org.dentalcard.service.impl;

import org.dentalcard.xml.XMLMenu;
import org.dentalcard.xml.XMLMenuItem;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import java.io.InputStream;

/**
 * @user: Vladimir Chernishov
 * @date: 20.12.11
 * @time: 23:28
 */
public class MenuManager {
    
    
    public XMLMenu getMenu(){

        try {
            JAXBContext jc = JAXBContext.newInstance(XMLMenu.class, XMLMenuItem.class);
            InputStream menuStream = MenuManager.class.getClassLoader().getResourceAsStream("menu.xml");
            return (XMLMenu) jc.createUnmarshaller().unmarshal(menuStream);
        } catch (JAXBException e) {
            e.printStackTrace();
        }
        return null;
    }
    
}
